package com.carstop.model;

import java.sql.Date;
import java.sql.Timestamp;
import java.util.List;

public class CarStopDetailService {

	private CarStopDetailDAO_interface dao;

	public CarStopDetailService() {
		dao = new CarStopDetailDAO();
	}

	public CarStopDetailVO addPathDetail(String stop_id, String driver_path_id, Timestamp arrival,Integer passenger) {

		CarStopDetailVO carStopDetailVO = new CarStopDetailVO();

		carStopDetailVO.setStop_id(stop_id);
		carStopDetailVO.setDriver_path_id(driver_path_id);
		carStopDetailVO.setArrival(arrival);
		//carStopDetailVO.setPassenger(passenger);
		dao.insert(carStopDetailVO);

		return carStopDetailVO;
	}

	public CarStopDetailVO updateDetail(String stop_id,String stop_id_org, String driver_path_id, Timestamp arrival) {

		CarStopDetailVO carStopDetailVO = new CarStopDetailVO();
        
		carStopDetailVO.setStop_id_org(stop_id_org);
		carStopDetailVO.setStop_id(stop_id);
		carStopDetailVO.setDriver_path_id(driver_path_id);
		carStopDetailVO.setArrival(arrival);
		//carStopDetailVO.setPassenger(passenger);
		dao.update(carStopDetailVO);

		return carStopDetailVO;
	}

	public void deletePathDetail(String driver_path_id) {
		dao.delete(driver_path_id);
	}

	public void deleteForRegular(Integer carStopDetailID) {
		dao.deleteForRegular(carStopDetailID);
		
		
	}

	public List<CarStopDetailVO> getAll() {
		return dao.getAll();
	}
	
	public CarStopDetailVO findByPrimaryKeyDetail(String driver_path_id,
			String stop_id) {
		return dao.findByPrimaryKey(driver_path_id,stop_id);
	}
	
	public List<CarStopDetailVO> findByForgeinnOneKeyDetail(String driver_path_id){
	  return dao.findByForgeinnOneKey(driver_path_id);
	} 

	
}
